public class Demo7 {
    public static void main(String[] args) throws InterruptedException{
        Thread t=new Thread(()->{
            while (true){
                System.out.println("hello thread");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }

        });

        t.start();

        //获取线程的这些属性
        System.out.println("线程ID:"+t.getId());
        System.out.println("线程名字:"+t.getName());
        System.out.println("线程状态"+t.getState());
    }
}
